/**
 * author:Administrator
 * date:2016/3/16
 * desc: 通用查询服务
 * 地区查询
 * 商品分类查询
 */

"use strict";

let query = require('../infrastructure/query');

class CommonQueryService {
  /*****************************************
   *               category 相关查询        *
   *****************************************/
  * allCategory() {
    return yield query.category.findAll();
  }

  * topCategory() {
    return yield query.category.findRoot();
  }

  * childCategory(pid) {
    return yield query.category.findChild(pid);
  }

  /*****************************************
   *               location 相关查询        *
   *****************************************/
  * allLocation() {
    return yield query.location.findAll();
  }

  * topLocation() {
    return yield query.location.findRoot();
  }

  * childLocation(pid) {
    return yield query.location.findChild(pid);
  }

}
module.exports = new CommonQueryService();
